<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <meta name="keywords" content="">
  <meta name="description" content="">
  <link rel="shortcut icon" href="favicon.ico">
  <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
  <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
  <link href="__PUBLIC__/admin/css/double-date.css" rel="stylesheet">
  <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
  <script src="__PUBLIC__/admin/js/double-date.js"></script>
</head>

<script>
  //删除url
  var deleteUrl = "{:url('order/delete')}";
  var url = "/{$Request.module}/yhorder";
</script>

<body class="gray-bg" >
<div class="wrapper wrapper-content" id="server">
  <style>
    .qiehuan{
      width:120px; height:40px; line-height:40px; font-size:14px; font-weight:bold; color:#333; background-color:#F5F5F6; float:left; margin-top:15px; margin-right:10px; text-align:center; cursor:pointer;
    }
  </style>
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>{$user_name}的订单列表</h5>
        </div>
        <div class="ibox-content">
          <div class="row">
            <div class="col-sm-5 m-b-xs">
              <div style="width:1300px; height:40px; margin-bottom:25px;">
                <a href="{:url('yhorder/lst',array('filter'=>10,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 10"}style="background-color: #1992FC;color: #FFF;"{/if}>全部</div></a>
              <a href="{:url('yhorder/lst',array('filter'=>1,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 1"}style="background-color: #1992FC;color: #FFF;"{/if}>待发货</div></a>
            <a href="{:url('yhorder/lst',array('filter'=>2,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 2"}style="background-color: #1992FC;color: #FFF;"{/if}>已发货</div></a>
          <a href="{:url('yhorder/lst',array('filter'=>3,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 3"}style="background-color: #1992FC;color: #FFF;"{/if}>已完成</div></a>
        <a href="{:url('yhorder/lst',array('filter'=>4,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 4"}style="background-color: #1992FC;color: #FFF;"{/if}>待支付</div></a>
      <a href="{:url('yhorder/lst',array('filter'=>5,'user_id'=>$userId))}"><div class="qiehuan" {if condition="$filter && $filter eq 5"}style="background-color: #1992FC;color: #FFF;"{/if}>已关闭</div></a>
  </div>
</div>
</div>

<div class="row" style="margin-top:15px;">
  <form action="{:url('yhorder/search')}" method="post" id="form_search">
    <div class="col-sm-2" style="float:right;">
      <div class="input-group">
        <input type="text" name="keyword" placeholder="请输入订单号" {if condition="(isset($keyword)) AND ($keyword)"}value="{$keyword}"{/if} class="input-sm form-control" /><span class="input-group-btn">
                                    <button type="submit" class="btn btn-sm btn-primary">搜索</button></span>
      </div>
    </div>

    <input type="hidden" name="user_id" value="{$userId}">

    <div style="float:right; font-size:15px; margin-right:10px;">
      <select style="height:30px; line-height:30px; border:1px solid #e5e6e7;" name="zf_type">
        <option value="0" {if condition="isset($zf_type) && $zf_type eq 0"}selected="selected"{/if}>支付方式</option>
        <option value="1" {if condition="isset($zf_type) && $zf_type eq 1"}selected="selected"{/if}>支付宝支付</option>
        <option value="2" {if condition="isset($zf_type) && $zf_type eq 2"}selected="selected"{/if}>微信支付</option>
        <option value="3" {if condition="isset($zf_type) && $zf_type eq 3"}selected="selected"{/if}>余额支付</option>
      </select>
    </div>

    <div style="float:right; font-size:15px; margin-right:10px;">
      <select style="height:30px; line-height:30px; border:1px solid #e5e6e7;" name="order_zt">
        <option value="0" {if condition="isset($order_zt) && $order_zt eq 0"}selected="selected"{/if}>状态</option>
        <option value="1" {if condition="isset($order_zt) && $order_zt eq 1"}selected="selected"{/if}>待发货</option>
        <option value="2" {if condition="isset($order_zt) && $order_zt eq 2"}selected="selected"{/if}>已发货</option>
        <option value="3" {if condition="isset($order_zt) && $order_zt eq 3"}selected="selected"{/if}>已完成</option>
        <option value="4" {if condition="isset($order_zt) && $order_zt eq 4"}selected="selected"{/if}>待支付</option>
        <option value="5" {if condition="isset($order_zt) && $order_zt eq 5"}selected="selected"{/if}>已关闭</option>
      </select>
    </div>

    <div style="float:right; font-size:15px; margin-right:10px;">
      <select style="height:30px; line-height:30px; border:1px solid #e5e6e7;" name="order_type">
        <option value="0" {if condition="isset($order_type) && $order_type eq 0"}selected="selected"{/if}>全部类型</option>
        <option value="1" {if condition="isset($order_type) && $order_type eq 1"}selected="selected"{/if}>普通订单</option>
        <option value="2" {if condition="isset($order_type) && $order_type eq 2"}selected="selected"{/if}>拼团订单</option>
      </select>
    </div>


    <div class="date fr" id="to" style="float:right; font-size:15px; margin-right:10px;">
      <input type="text" name="endtime" readonly="readonly" placeholder="结束时间" {if condition="(isset($endtime)) AND ($endtime)"}value="{:date('Y-m-d',$endtime)}"{/if} class="date-check">
    </div>

    <div class="date date1 fl" id="from" style="float:right; font-size:15px; margin-right:10px;">
      <input type="text" name="starttime" readonly="readonly" placeholder="开始时间" {if condition="(isset($starttime)) AND ($starttime)"}value="{:date('Y-m-d',$starttime)}"{/if} class="date-check">
    </div>

    <div style="float:right; margin-right:10px; font-size:15px;">
      <select class="input-sm form-control input-s-sm inline" name="area_id" id="areaname">
        <option {if condition="(isset($area_id)) AND ($area_id eq 0)"}selected="selected"{/if} value="0" >全部区县</option>
        {if condition="(isset($areares)) AND ($areares)"}
        {foreach name="areares" item="v"}
        <option value="{$v.id}" {if condition="(isset($area_id)) AND ($area_id eq $v['id'])"}selected="selected"{/if}>{$v.zm}.{$v.area_name}</option>
        {/foreach}
        {/if}
      </select>
    </div>

    <div style="float:right; margin-right:10px; font-size:15px;">
      <select class="input-sm form-control input-s-sm inline" name="city_id" id="cityname">
        <option {if condition="(isset($city_id)) AND ($city_id eq 0)"}selected="selected"{/if} value="0">全部城市</option>
        {if condition="(isset($cityres)) AND ($cityres)"}
        {foreach name="cityres" item="v"}
        <option value="{$v.id}" {if condition="(isset($city_id)) AND ($city_id eq $v['id'])"}selected="selected"{/if}>{$v.zm}.{$v.city_name}</option>
        {/foreach}
        {/if}
      </select>
    </div>

    <div style="float:right; margin-right:10px; font-size:15px;">
      <select class="input-sm form-control input-s-sm inline" name="pro_id">
        <option {if condition="(isset($pro_id)) AND ($pro_id eq 0)"}selected="selected"{/if} value="0">全部省份</option>
        {foreach name="prores" item="v"}
        <option value="{$v.id}" {if condition="(isset($pro_id)) AND ($pro_id eq $v['id'])"}selected="selected"{/if}>{$v.zm}.{$v.pro_name}</option>
        {/foreach}
      </select>
    </div>

  </form>
</div>
<div id="ajaxpagetest">
  {include file="yhorder/ajaxpage" /}
</div>
</div>
</div>
</div>
</div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/admin/js/common/admin.js"></script>
<script src="__PUBLIC__/admin/js/common/ajax.js"></script>

<script>

  $(function(){
    $('select[name=pro_id]').change(function(){
      var pro_id = $(this).val();
      if(pro_id != 0){
        $.ajax({
          url:"{:url('order/getcitylist')}",
          type:'POST',
          data:{'pro_id':pro_id},
          dataType:'json',
          success:function(data){
            if(data){
              var html = '';
              html='<option value="0">全部城市</option>';
              $.each(data,function(i,v){
                html+='<option value="'+v.id+'">'+v.zm+'.'+v.city_name+'</option>';
              });
              $('#cityname').html(html);
              var html2='<option value="0">全部区县</option>';
              $('#areaname').html(html2);
            }else{
              var html='<option value="0">全部城市</option>';
              $('#cityname').html(html);
              var html2='<option value="0">全部区县</option>';
              $('#areaname').html(html2);
            }
          },
          error:function(){
            location.reload();
          }
        });
      }else{
        var html='<option value="0">全部城市</option>';
        $('#cityname').html(html);
        var html2='<option value="0">全部区县</option>';
        $('#areaname').html(html2);
      }
    });

    $('select[name=city_id]').change(function(){
      var city_id = $(this).val();
      if(city_id != 0){
        $.ajax({
          url:"{:url('order/getarealist')}",
          type:'POST',
          data:{'city_id':city_id},
          dataType:'json',
          success:function(data){
            if(data){
              var html = '';
              var html='<option value="0">全部区县</option>';
              $.each(data,function(i,v){
                html+='<option value="'+v.id+'">'+v.zm+'.'+v.area_name+'</option>';
              });
              $('#areaname').html(html);
            }else{
              var html='<option value="0">全部区县</option>';
              $('#areaname').html(html);
            }
          },
          error:function(){
            location.reload();
          }
        });
      }else{
        var html='<option value="0">全部区县</option>';
        $('#areaname').html(html);
      }
    });
  });

  function getinfo(id,user_id,obj){
    var infoUrl = url+'/info/order_id/'+id+'/user_id/'+user_id;
    location.href=infoUrl;
  }

</script>

</body>
</html>